Revert "QWidgetWindow: Immediately forward close events to QWindow"
authorFabian Vogt <fabian@ritter-vogt.de>
Fri, 29 Jun 2018 07:15:51 +0000 (09:15 +0200)
committerLisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
Tue, 25 Sep 2018 21:26:54 +0000 (22:26 +0100)
This reverts commit e0b5ff4ad583befbecbcbe462998e3ed80899531.

References: kde#395988
References: QTBUG-43344

Gbp-Pq: Name Revert-QWidgetWindow-Immediately-forward-close-event.patch

src/widgets/kernel/qwidgetwindow.cpp
tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp

index 1f3057b008df830e596c2084562b43174fcbacde..24e0173ac142aa51a30db3df9d97146e24a15a4f 100644 (file)
@@ -237,7 +237,6 @@ bool QWidgetWindow::event(QEvent *event)
     switch (event->type()) {
     case QEvent::Close:
         handleCloseEvent(static_cast<QCloseEvent *>(event));
-        QWindow::event(event);
         return true;
 
     case QEvent::Enter:
index 6a049aedf1efb44f2bfc9249c7c9da97962eb0d6..c7dab650fe4f13682e4096ddddb60595d452c5f0 100644 (file)
@@ -401,8 +401,6 @@ private slots:
 
     void tabletTracking();
 
-    void closeEvent();
-
 private:
     bool ensureScreenSize(int width, int height);
 
@@ -10800,31 +10798,5 @@ void tst_QWidget::tabletTracking()
     QTRY_COMPARE(widget.moveEventCount, 3);
 }
 
-class CloseCountingWidget : public QWidget
-{
-public:
-    int closeCount = 0;
-    void closeEvent(QCloseEvent *ev) override;
-};
-
-void CloseCountingWidget::closeEvent(QCloseEvent *ev)
-{
-    ++closeCount;
-    ev->accept();
-}
-
-void tst_QWidget::closeEvent()
-{
-    CloseCountingWidget widget;
-    widget.show();
-    QVERIFY(QTest::qWaitForWindowExposed(&widget));
-    // Yes we call the close() function twice. This mimics the behavior of QTBUG-43344 where
-    // QApplication first closes all windows and then QCocoaApplication flushes window system
-    // events, triggering more close events.
-    widget.windowHandle()->close();
-    widget.windowHandle()->close();
-    QCOMPARE(widget.closeCount, 1);
-}
-
 QTEST_MAIN(tst_QWidget)
 #include "tst_qwidget.moc"